Welcome Guest | Sign in | Register

Home > C Programming > Pointers & Structures > Questions and Answers

Exercise:

Section 1

01. Declare a pointer to a structure of type date called dates.
A. struct dates dates; B. struct *date *dates;
C. struct dates date; D. struct date *dates;

Answer and Explanation

Answer: struct date *dates;

Explanation:
There is no explanation...

Report Errors

Name:

Loading...

VView Answer | RReport | DDiscuss in Forum
02. If the above structure of type date comprises three integer fields, day, month, year, assign the value 10 to the field day using the dates pointer.
A. dates.day = 10; B. dates->day = 10;
C. dates = 10.day; D. day.dates = 10;

Answer and Explanation

Answer: dates->day = 10;

Explanation:
There is no explanation...

Report Errors

Name:

Loading...

VView Answer | RReport | DDiscuss in Forum
03. A structure of type machine contains two fields, an integer called name, and a char pointer calledmemory. Show what the definition of the structure looks like.
A. Choice 1
struct machine {
int name;
char memory;
}
B. Choice 2
machine {
name : integer;
memory : char^;
};
C. Choice 3
struct machine {
int name;
char *memory;
};
D. None of these

Answer and Explanation

Answer: Choice 3
struct machine {
int name;
char *memory;
};

Explanation:
There is no explanation...

Report Errors

Name:

Loading...

VView Answer | RReport | DDiscuss in Forum
04. A pointer called mpu641 of type machine is declared. What is the command to assign the value NULL to the field memory.
A. mpu641->memory = (char *) NULL; B. mpu641.memory = 0;
C. mpu641-memory = 0; D. strcpy( mpu641.memory, NULL);

Answer and Explanation

Answer: mpu641->memory = (char *) NULL;

Explanation:
There is no explanation...

Report Errors

Name:

Loading...

VView Answer | RReport | DDiscuss in Forum
05. Assign the address of the character array CPUtype to the field memory using the pointer mpu641.
A. mpu641.memory = &CPUtype; B. mpu641->memory = CPUtype;
C. strcpy( mpu641.memory, CPUtype); D. mpu641.memory = CPUtype;

Answer and Explanation

Answer: mpu641->memory = CPUtype;

Explanation:
There is no explanation...

Report Errors

Name:

Loading...

VView Answer | RReport | DDiscuss in Forum
06. Assign the value 10 to the field name using the pointer mpu641.
A. mpu641.name = 10; B. mpu641->name = 10;
C. mpu641.name = *10; D. *mpu641.name = 10;

Answer and Explanation

Answer: mpu641->name = 10;

Explanation:
There is no explanation...

Report Errors

Name:

Loading...

VView Answer | RReport | DDiscuss in Forum
07. A structure pointer times of type time (which has three fields, all pointers to integers, day, month and year respectively) is declared. Using the pointer times, update the field day to 10.
A. times.day = 10; B. *(times->day) = 10;
C. *times.day = 10; D. times.day = *10;

Answer and Explanation

Answer: *(times->day) = 10;

Explanation:
There is no explanation...

Report Errors

Name:

Loading...

VView Answer | RReport | DDiscuss in Forum
08. An array of pointers (10 elements) of type time (as detailed above in 7.), called sample is declared. Update the field month of the third array element to 12.
A. *(sample[2]->month) = 12; B. sample[3].month = 12;
C. *sample[2]->month = 12; D. *(sample[3]->month) = 12;

Answer and Explanation

Answer: *(sample[2]->month) = 12;

Explanation:
There is no explanation...

Report Errors

Name:

Loading...

VView Answer | RReport | DDiscuss in Forum



Partner Sites
LucentBlackBoard.com                  SoftLucent.com                  LucentJobs.com
All rights reserved © 2012-2015 SoftLucent.